"""babycries URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""

from django.contrib import admin
from django.urls import path, include, re_path

# from django.conf.urls.i18n import i18n_patterns
import userprofile.views
from django.conf import settings
from django.conf.urls.static import static
from django.views.static import serve
from django.views.generic import TemplateView

urlpatterns = [
    path("admin/", admin.site.urls),
    re_path(r"^$", TemplateView.as_view(template_name="home.html"), name="home"),
    re_path(
        r"^product-showcase$",
        TemplateView.as_view(template_name="product_showcase.html"),
        name="product_showcase",
    ),
    re_path(
        r"^about-us$",
        TemplateView.as_view(template_name="about_us.html"),
        name="about_us",
    ),
    # path(
    #     "", include("disease_recognition.urls")
    # ),  # 首页 则为信息页（当未登录 自动跳转到login页）
    path(
        "disease_recognition/", # 注意路由分类目录 
        include(
            ("disease_recognition.urls", "disease_recognition"),
            namespace="disease_recognition",
        ),
    ),
    path(
        "llm_consultation/",
        include(
            ("llm_consultation.urls", "llm_consultation"),
            namespace="llm_consultation",
        ),
    ),
    # 注意路由最后 一个 /
    path("i18n/", include("django.conf.urls.i18n")),
    path(
        "accounts/password/reset/",
        userprofile.views.password_reset,
        name="account_reset_password",
    ),
    path("accounts/", include("allauth.urls")),
    path("accounts/", include("userprofile.urls")),  # 用户信息
    # static(settings.STATIC_URL, document_root=settings.STATIC_ROOT),
    re_path(
        r"^static/(?P<path>.*)$",
        serve,
        {"document_root": settings.STATIC_ROOT},
        name="static",
    ),
    re_path(
        r"^media/(?P<path>.*)$",
        serve,
        {"document_root": settings.MEDIA_ROOT},
        name="media",
    ),
    
]

